<?php

require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
if ($CURUSER < UC_MODERATOR && $CURUSER['id'] != $betsadmin)
	stderr("错误", "权限不足");
$id = isset($_GET['id']) && is_valid_id($_GET['id']) ? $_GET['id'] : 0;
$res = sql_query("SELECT active FROM betgames WHERE id =" . sqlesc($id) . "") or sqlerr(__FILE__, __LINE__);
$res = mysql_fetch_assoc($res);
if ($res['active'] == 0)
	$status = 1;
else
	$status = 0;
if (isset($res['finished']) == 1)
	$status = 0;
sql_query("UPDATE betgames SET active =" . sqlesc($status) . " WHERE id =" . sqlesc($id) . "") or sqlerr(__FILE__, __LINE__);
header("location: bet_admin.php");
